package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	AppEventNew          = "running.AppNew"
	AppEventBeforeCreate = "running.AppBeforeCreate"
	AppEventBeforeUpdate = "running.AppBeforeUpdate"
	AppEventBeforeSave   = "running.AppBeforeCreate running.AppBeforeUpdate"
	AppEventAfterCreate  = "running.AppAfterCreate"
	AppEventAfterUpdate  = "running.AppAfterUpdate"
	AppEventAfterSave    = "running.AppAfterCreate running.AppAfterUpdate"
	AppEventDelete       = "running.AppDelete"

	AppAccessControlEvent = "running.AppAccessControl"
)

func GetAppConfig() *mgo.DocConfig {
	return App_Config
}

var App_Config *mgo.DocConfig

func init() {
	App_Config = NewAppConfig()
}

func NewAppConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "running.App",
		Fields: []string{
			"name", "app", "root", "note",
		},
		RelationFields:  []string{},
		RelationConfigs: map[string]*mgo.DocRelation{},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
